#!/usr/bin/env python
# encoding: utf-8

import web


#    'kanban',
#    'gtd',
#    'checklist',
#    'category',
#    'project',
#    'common',
#urlpatterns += patterns("kanban.views",
#    (r"^kanban/(?P<prj_id>\w+)/list$", "list"),
#    (r"^kanban/(?P<prj_id>\w+)/add$", "add"),
#)
#urlpatterns += patterns("project.views",
#    (r"^project/list$", "list"),
#    (r"^project/add$", "add"),
#)
#
#urlpatterns += patterns("django.views.static",
#    (r"^js/(?P<path>.*)$", "serve", {"document_root": SITE_ROOT + "/media/js/"}),
#    (r"^css/(?P<path>.*)$", "serve", {"document_root": SITE_ROOT + "/media/css/ui-lightness/"}),
#)

from kanban.views import app as kanban_app
import settings

urls = (
        '/kanban', kanban_app,
        '/count', "count",
        '/count2', "count2",
        '/count3', "count3",
        '/kill', "reset",
        '/(.*)', "index"
        )

app = web.application(urls, globals(), autoreload=True)

if web.config.get('_session') is None:
    session = web.session.Session(app, web.session.DiskStore('sessions'), {'count': 0})
    web.config._session = session
else:
    session = web.config._session


class count():
    def GET(self):
        session['count'] += 1
        return  settings.render("index.html", name=str(session['count']))

class count3():
    def GET(self):
        session['count'] += 1
        return  settings.render("index_3.html", name=str(session['count']))
class count2():
    def GET(self):
        session['count'] += 1
        return  settings.render("index_2.html", name=str(session['count']))

class reset():
    def GET(self):
        session.kill()
        return ""

class index:
    def GET(self, name):
        return settings.render("index.html", name=name)

if __name__ == "__main__":
    app.run()
